import { Component, OnInit } from '@angular/core';
import {Location} from '@angular/common'
import {ActivatedRoute, Router} from "@angular/router";

@Component({
  selector: 'app-deviation-overview',
  templateUrl: './deviation-overview.component.html',
  styleUrls: ['./deviation-overview.component.css']
})
export class DeviationOverviewComponent implements OnInit {

  constructor(public location: Location,
              public router: Router) {
  }

  public data1;
  public data2;
  public data3;
  public title1;
  public title2;
  public title3;

  ngOnInit() {
    this.data1 = [];
    this.data2 = [];
    this.data3 = [];
  }

  public goBack(flag?: boolean) {
    if (flag) {
      this.location.back()
    }
    else {
      this.router.navigate(['/pages/home'])
    }
  }

  getData() {

    this.data1 = [[40, 0.011],[45, 0.009],[50, 0.009],[55, 0.012],[60, 0.0175],[65, 0.017],[70, 0.014]];
    this.title1= "80%-85%";
    this.data2 = [[40, 0.017],[45, 0.014],[50, 0.011],[55, 0.012],[60, 0.016],[65, 0.014],[70, 0.012]];
    this.title2= "60%-65%";
    this.data3 = [[1388538000000, 1.1, 4.7],[1388624400000, 1.8, 6.4],[1388710800000, 1.7, 6.9],[1388797200000, 2.6, 7.4],
      [1388883600000, 3.3, 9.3],[1388970000000, 3.0, 7.9],[1389056400000, 3.9, 6.0],[1389142800000, 3.9, 5.5],
      [1389229200000, -0.6, 4.5],[1389315600000, -0.5, 5.3],
      [1389402000000, -0.3, 2.4],
      [1389488400000, -6.5, -0.4],
      [1389574800000, -7.3, -3.4],
      [1389661200000, -7.3, -2.3],
      [1389747600000, -7.9, -4.2],
      [1389834000000, -4.7, 0.9],
      [1389920400000, -1.2, 0.4],
      [1390006800000, -2.3, -0.1],
      [1390093200000, -2.0, 0.3],
      [1390179600000, -5.1, -2.0],
      [1390266000000, -4.4, -0.5],
      [1390352400000, -6.4, -2.7],
      [1390438800000, -3.2, -0.5],
      [1390525200000, -5.5, -0.8],
      [1390611600000, -4.4, 2.4],
      [1390698000000, -4.0, 1.1],
      [1390784400000, -3.4, 0.8],
      [1390870800000, -1.7, 2.6],
      [1390957200000, -3.1, 3.9],
      [1391043600000, -4.8, -1.9],
      [1391130000000, -7.0, -2.8]];
    this.title3= "60%-65%";
  }
}
